public class QuadraticEquationSolver {
    public double[] solve(double a, double b, double c) {
        double discriminant = b * b - 4 * a * c;
        double[] solutions = new double[2];
        if (discriminant > 0) {
            solutions[0] = (-b + Math.sqrt(discriminant)) / (2 * a);
            solutions[1] = (-b - Math.sqrt(discriminant)) / (2 * a);
        } else if (discriminant == 0) {
            solutions[0] = solutions[1] = -b / (2 * a);
        } else {
            solutions[0] = solutions[1] = Double.NaN; // No real solutions
        }
        return solutions;
    }
}
